<template>
  <div class="overview-style">
    <div class="top-select-group">
      <el-date-picker
        v-model="value1"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      ></el-date-picker>
      <el-input placeholder="请输入操作人信息" v-model="searchKeyword" clearable style="width: 216px"></el-input>
      <el-button type="primary">搜索</el-button>
      <el-button style="float:right;">导出当前数据</el-button>
    </div>
    <div class="bottom-table-group">
      <el-table
        :header-cell-style="{'background-color':'#e6f1ff','height':'62px'}"
        ref="multipleTable"
        :data="tableData"
        v-loading="isLoading"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        :cell-style="cellStyle"
      >
        <el-table-column prop="operatePerson" label="操作人" align="center"></el-table-column>
        <el-table-column prop="operatorAction" label="操作动作" align="center"></el-table-column>
        <el-table-column prop="operatorClass" label="操作对象" align="center"></el-table-column>
        <el-table-column prop="operatorTime" label="操作时间" align="center"></el-table-column>
        <el-table-column prop="operatorIp" label="操作IP" align="center"></el-table-column>
      </el-table>
      <div class="bottom-pagination-group">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="pageSize"
          layout="total, prev, pager, next,sizes, jumper"
          :total="totalData"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import api from "@/api/api";
export default {
  name: "SettingOperationLog",
  components: {},
  props: {},
  data() {
    return {
      tableData: [],
      totalData: 0,
      currentPage: 1,
      pageSize: 10,
      totalData: 0,
      isLoading: false
    };
  },
  watch: {},
  computed: {},
  methods: {
    getPageData() {
      this.isLoading = true;
      api
        .getAllWorkLogAPI({
          page: this.currentPage,
          limit: this.pageSize
        })
        .then(res => {
          this.isLoading = false;
          let { error, data } = res.data;
          if (error) {
            this.$message.error("请求接口异常");
          } else {
            this.totalData = data.total;
            this.tableData = data.page;
          }
        });
    }
  },
  created() {
    this.getPageData();
  },
  mounted() {}
};
</script>

<style scoped>
.overview-style {
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
}
.bottom-pagination-group {
  padding: 20px 20px 0;
  float: right;
}
.bottom-table-group {
  margin-top: 20px;
  display: inline-block;
  width: 100%;
}
</style>
